﻿using System;
using System.Collections.Generic;
using System.Web;

namespace WebMvc.App.Web.Default.YMC.IndexController
{
    public class IndexAction  : NFinal.BaseAction
	{
		public IndexAction(System.IO.TextWriter tw):base(tw){}
		public IndexAction(string fileName) : base(fileName) {}
        public struct __Index_user__
		{
			
			public int id;
			
			public string name;
			
			public string pwd;
			
		}
		public void Index(string say)
        {
            	var __Index_user_con__ = new MySql.Data.MySqlClient.MySqlConnection(ConnectionString.tiaojiu);
            __Index_user_con__.Open();
			var user = new __Index_user__();
            
			var __Index_user_command__ = new MySql.Data.MySqlClient.MySqlCommand("select * from user where id=1", __Index_user_con__);
			
			var __Index_user_reader__= __Index_user_command__.ExecuteReader();
			if (__Index_user_reader__.HasRows)
			{
				__Index_user_reader__.Read();

				user = new __Index_user__();
				
				if(!__Index_user_reader__.IsDBNull(1-1)){user.id = __Index_user_reader__.GetInt32(1-1);}
				
				if(!__Index_user_reader__.IsDBNull(2-1)){user.name = __Index_user_reader__.GetString(2-1);}
				
				if(!__Index_user_reader__.IsDBNull(3-1)){user.pwd = __Index_user_reader__.GetString(3-1);}
				
			}
			__Index_user_reader__.Close();
			__Index_user_con__.Close();;
            LitJson.JsonData data=new LitJson.JsonData();
            data["id"]=user.id;
            data["name"]=user.name;
            AjaxReturn(data);
        }
    }
}